<?php
namespace app\models;
use yii\base\Model;

class Upload extends Model
{
	public $uploadFile;

	public function rules(){
		return [
			['uploadFile','file','skipOnEmpty'=>false,'extensions'=>'jpg,png']
		];
	}

	public function upload(){
		if($this->validate()){
			$this->uploadFile->saveAs('../runtime/'.$this->uploadFile->basename.'.'.$this->uploadFile->extensions);
			return true;
		}
		return false;
	}
}


?>